package demo_0428;

import javax.swing.*;
import java.awt.*;

public class BorderLayoutDemo {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setBounds(100,100,400,300);
        
        //frame.setLayout(new FlowLayout());

        JButton button1 = new JButton("按钮1");
        frame.add(button1, BorderLayout.NORTH);
        JButton button2 = new JButton("按钮2");
        frame.add(button2, BorderLayout.WEST);


        JPanel centerpanel = new JPanel();
        centerpanel.setLayout(new BorderLayout());
        JPanel panel1 = new JPanel();
        JPanel panel2 = new JPanel();
        centerpanel.add(panel1, BorderLayout.NORTH);
        centerpanel.add(panel2, BorderLayout.SOUTH);

        panel1.add(new JButton("按钮1"));
        panel1.add(new JButton("按钮2"));
        panel1.add(new JButton("按钮3"));

        panel2.add(new JButton("p2按钮1"));
        panel2.add(new JButton("p2按钮2"));


        JButton button3 = new JButton("按钮3");
        frame.add(button3, BorderLayout.CENTER);
        JButton button4 = new JButton("按钮4");
        frame.add(button4, BorderLayout.SOUTH);
        

        frame.setVisible(true);
    }
}

